Skip to content
This repository has been archived by the owner on Sep 25, 2020. It is now read-only.

SpotFleet CloudFormation #69

Merged
merged 15 commits into from
Jun 26, 2017
Merged

SpotFleet CloudFormation #69

merged 15 commits into from
Jun 26, 2017

Conversation

selmertsx
Copy link
Contributor

@selmertsx selmertsx commented Jun 20, 2017

issue

#68

概要

最初は何も考えなくて済むように、とりあえず InstanceTypeと、ImageIdは決め打ち。
m4.large のほうが、weightが高くなるようにしている。
このあと IAMFleetRoleの設定していきます。

ami id の設定
http://docs.aws.amazon.com/ja_jp/AmazonECS/latest/developerguide/launch_container_instance.html

ecs用cloudformationの設定
http://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/quickref-ecs.html

Type: AWS::EC2::SpotFleet
Properties:
SpotFleetRequestConfigData:
IamFleetRole: !GetAtt [IAMFleetRole, Arn]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

=> IAMFleetRole.Arn

Properties:
SpotFleetRequestConfigData:
IamFleetRole: !GetAtt [IAMFleetRole, Arn]
SpotPrice: '0.139'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

このあたりはパラメータ設定出来るようにする!

Type: Number
TargetCapacity:
Default: 2
Type: Number
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pataiji
来週レビューお願いします 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

差分、見やすい様に lambda-endpointをmerge先に向けています。
コードに問題無ければ masterにmergeします。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pataiji
指摘して貰った点修正したので、今日、暇な時にレビューお願いします!!

@selmertsx selmertsx changed the title 【WIP】SpotFleet CloudFormation SpotFleet CloudFormation Jun 26, 2017
Copy link
Contributor

@pataiji pataiji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2点コメントしました

Fn::Base64: !Sub |
#!/bin/bash
echo ECS_CLUSTER=${ECSCluster} >> /etc/ecs/ecs.config
NetworkInterfaces:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

このプロパティはいらないような?
subnetでpublic ipを振るように設定しているので特に指定しなければ勝手にpub ip付けてくれると思います。

MapPublicIpOnLaunch: true

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

このプロパティは、NetworkInterfacesのDeleteOnTerminationをtrueにするために書きました。
( それ以外の属性は、require trueのもののみ書いてる状態です )

明示的に指定しない場合、Subnet設定だけで Network Interfaceが消えるという資料を見つけられなかったからです。とはいえ、この設定だといるかいらないか判断かつかないので、一回消してみて、Network Interfaceが消えなかったら、再度対応します!

LaunchSpecifications:
# NOTE:
# If you want to use other type of ec2 instances,
# fix these parameters
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parametersでinstanceType指定できるようにした方が良い気がします。(デフォルト設定はいれておいて)
weightを偏らせているのでMainInstanceTypeとSubInstanceTypeとか?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

たしかに!
parameterに入れといた方が、typeやidを変えたいときに、コード変えなくても大丈夫ですしね。
対応しておきます

SubContainerInstanceType:
Default: 'm3.large'
Type: String
SubContainerInstanceImageId:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instance毎にimageを変えることあるかな?という気がしたのでこれに関しては共通のparametersで良いかなと思ったんですがどうでしょう?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

あ、たしかに。
別々にするメリット無いですね!

To change instance type and Id without modifying cloudformation.yml.
@selmertsx selmertsx force-pushed the spotfleet_cloudformation branch from 08bac3d to 7656843 Compare June 26, 2017 02:15
@pataiji
Copy link
Contributor

pataiji commented Jun 26, 2017

LGTM!!:+1:

@selmertsx
Copy link
Contributor Author

レビューありがとうございました!

@selmertsx selmertsx changed the base branch from lambda-endpoint to master June 26, 2017 04:08
@selmertsx selmertsx merged commit 44b822d into master Jun 26, 2017
@selmertsx selmertsx deleted the spotfleet_cloudformation branch June 26, 2017 04:08
@selmertsx selmertsx mentioned this pull request Jun 27, 2017
5 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants